﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		ISessionFactory.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 //   File:            ISessionFactory.cs
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System;
using NHibernate;

namespace Dexter.Repository.NHibernate.SessionFactory {
	/// <summary>
	/// Abstract creation of the Nhibernate session.
	/// </summary>
	public interface ISessionFactory {
		/// <summary>
		/// Prepares the sesson.
		/// </summary>
		/// <param name="isReadOnly">if set to <c>true</c> [is read only].</param>
		void PrepareSesson ( bool isReadOnly );

		/// <summary>
		/// Create a session in the current context. If the context already created a 
		/// session, then the active transaction is returned
		/// </summary>
		/// <returns></returns>
		ISession GetSession ( );

		/// <summary>
		/// This call close the current opened session, and commit/rollback the
		/// transaction if the session was created in transaction.
		/// <remarks>In this first version of the session factory, the session is always
		/// in transaction.</remarks>
		/// </summary>
		void CloseCurrentSession ( Boolean commitIfInTransaction );
	}
}
